//2009/08/10 13:47:35
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

using namespace std;

class CountGame
{
public:
    int howMany(int maxAdd, int goal, int next)
    {
        int ret = (goal - next + 1) % (maxAdd + 1);
        return ret ==0 ? -1 : ret;
    }
};
